import 'dart:convert';

CommentListModel commentListModelFromJson(String str) => CommentListModel.fromJson(json.decode(str));

String commentListModelToJson(CommentListModel data) => json.encode(data.toJson());

class CommentListModel {
  int code;
  String ? msg;
  List<CommentData> ? data;

  CommentListModel({
    required this.code,
    this.msg,
    this.data,
  });

  factory CommentListModel.fromJson(Map<String, dynamic> json) => CommentListModel(
    code: json["code"],
    msg: json["msg"],
    data: List<CommentData>.from(json["data"].map((x) => CommentData.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "msg": msg,
    "data": List<dynamic>.from(data!.map((x) => x.toJson())),
  };
}

class CommentData {
  int id;
  int fid;
  int uid;
  String nickname;
  String avatar;
  String content;
  int score;
  int isTop;
  String createTime;

  CommentData({
    required this.id,
    required this.fid,
    required this.uid,
    required this.nickname,
    required this.avatar,
    required this.content,
    required this.score,
    required this.isTop,
    required this.createTime,
  });

  factory CommentData.fromJson(Map<String, dynamic> json) => CommentData(
      id: json["id"],
      fid: json["fid"],
      uid: json["uid"],
      nickname: json["nickname"],
      avatar: json["avatar"],
      content: json["content"],
      score: json["score"],
      isTop: json["isTop"],
      createTime: json["createTime"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "fid,": fid,
    "uid": uid,
    "nickname": nickname,
    "avatar": avatar,
    "content": content,
    "score": score,
    "isTop": isTop,
    "createTime": createTime,
  };
}
